"use strict";
cc._RF.push(module, '738fbiM7hFF8K9BPH8CfxdM', 'uiGamePanel');
// common/script/uiGamePanel.js

"use strict";

var mvs = require("Matchvs");
var GLB = require("Glb");
cc.Class({
    extends: require("uiPanel"),

    properties: {
        gomeover: cc.Node,
        readClip: {
            default: null,
            url: cc.AudioClip
        }
    },

    onLoad: function onLoad() {
        this._super();
        cc.audioEngine.play(this.jumpClip, false, 3);
        this.gomeover.active = false;
        this.isGameOverPlay = false;
        clientEvent.on(clientEvent.eventType.gameOver, this.gameOver, this);
        clientEvent.on(clientEvent.eventType.leaveRoomNotify, this.leaveRoom, this);
        clientEvent.on(clientEvent.eventType.leaveRoomMedNotify, this.leaveRoom, this);
        this.nodeDict["exit"].on("click", this.exit, this);
    },
    leaveRoom: function leaveRoom(data) {
        if (Game.GameManager.gameState !== GameState.Over) {
            uiFunc.openUI("uiTip", function (obj) {
                var uiTip = obj.getComponent("uiTip");
                if (uiTip) {
                    uiTip.setData("对手离开了游戏");
                }
            }.bind(this));
        }
    },
    exit: function exit() {
        uiFunc.openUI("uiExit");
    },
    gameOver: function gameOver() {
        if (!this.isGameOverPlay) {
            this.gomeover.active = true;
            this.isGameOverPlay = true;
        }
    },
    update: function update() {},
    onDestroy: function onDestroy() {
        clientEvent.off(clientEvent.eventType.gameOver, this.gameOver, this);
        clientEvent.off(clientEvent.eventType.leaveRoomNotify, this.leaveRoom, this);
        clientEvent.off(clientEvent.eventType.leaveRoomMedNotify, this.leaveRoom, this);
    }
});

cc._RF.pop();